package com.cyt.sys.model.po;

import cn.hutool.core.date.DateTime;
import com.cyt.base.util.BaseUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 基础部分-组织人员
 *
 * @author shengQiang yu
 * @date 2019-01-28 16:19
 */
@Data
@NoArgsConstructor
@Table(name = "base_org_user")
public class SysOrgUser implements Serializable {

    /**
     * 组织机构id
     */
    @Id
    private String id;

    /**
     * 机构表Id
     */
    @Column(name = "org_id")
    private String orgId;

    /**
     * 用户表Id
     */
    @Column(name = "user_id")
    private String userId;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 用户名称
     */
    @Transient
    private String userName;

    /**
     * 组织机构名称
     */
    @Transient
    private String orgName;

    public SysOrgUser(String userId, String orgId) {
        this.id = BaseUtil.uId();
        this.orgId = orgId;
        this.userId = userId;
        this.createTime = new DateTime();
    }

}
